package ar.com.solidussource.howmuchservices.common.entities.filter;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import ar.com.solidussource.framework.backend.dao.filter.OrderedFilter;

public class UserFilter extends OrderedFilter {

	private String username;
	
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	@Override
	public void fillCriteriaNotPagination(Criteria arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void fillCriteriaNoOrder(Criteria criteria) {
		if (getUsername() != null) {
			criteria.add(Restrictions.eq("username", this.username));
		}
		
		criteria.add(Restrictions.eq("deleted", false));
		
	}

}
